<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  <base href="../resources/" />
  <title>全由IM</title> 
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> 
  <link rel="stylesheet" type="text/css" href="js/easyui/themes/gray/easyui.css" /> 
  <link rel="stylesheet" type="text/css" href="js/easyui/themes/icon.css" /> 
  <link rel="stylesheet" type="text/css" href="css/web.css" /> 
  <link rel="stylesheet" type="text/css" href="css/icon/font-awesome.min.css" /> 
  <script type="text/javascript" src="js/jquery.min.js"></script> 
  <script type="text/javascript" src="js/jquery.thooClock.js"></script> 
  <script type="text/javascript" src="js/easyui/jquery.easyui.min.js"></script> 
  <script type="text/javascript" src="js/easyui/locale/easyui-lang-zh_CN.js"></script>
<style type="text/css">
.clock {
	position: fixed;
	top: 50%;
	left: 50%;
	width: 50%;
	height: 50%;
	-webkit-transform: translateX(-50%) translateY(-50%);
}
#topbar{padding:0 5px;}
#topbar-system{padding-top:4px;}
</style>
<script>
/**
 * 组装树结构
 */
function makeEasyTree(data){ 
    if(!data)  
        return [];
    
    var _newData = []; //最终返回结果  
    var _treeArray = {}; //记录一级节点  
    var _root = null; //最顶层fid  
    var _idKey = "id"; //主键的键名  
    var _fidKey = "fid"; //父ID的键名  
    _getChildren(_root);  
    function _getChildren($root){  
        var $children = [];  
        for (var i in data){  
            if($root == data[i][_fidKey]){  
                data[i]["children"] = _getChildren(data[i][_idKey]);  
                $children.push(data[i]);  
            }  
            //只要一级节点  
            if(_root == data[i][_fidKey] && !_treeArray[data[i][_idKey]]){  
                _treeArray[data[i][_idKey]] = data[i];  
                _newData.push(data[i]);  
            }  
        }  
        return $children;  
    }  
    return _newData;  
} 

	/**
	*获取组织树数据
	*/
	var menuData=[];
	  $.ajax({
			type : 'post',
			url : '../getOrgUserTree',
			cache : false,
			processData : true,
			dataType : 'json',
			success : function(data) {
				data=makeEasyTree(data);
				data=JSON.stringify(data);
				menuData=JSON.parse(data);
			},
			async : false
	}); 
	  $('#win').window({    
		    width:600,    
		    height:400,    
		    modal:true   
		}); 
	 /**
	 *组织节点点击事件
	 */
	function nodeClick(node){
		var pid=node.id;
		$("#useriframe").attr("src","../im/orguserinfo.jsp?pid="+pid);
	}
  
  </script> 
 </head> 
 <body class="easyui-layout">
	<div data-options="region:'west',collapsible:false,iconCls:'fa fa-leaf'" style="width: 200px;"> 
  		<div class="easyui-accordion" data-options="fit:true" style="overflow: scroll;">
				<ul id="tt" class="easyui-tree" data-options="data:menuData,animate:true,onClick:nodeClick"></ul>  
		</div>
  	</div> 
  <div data-options="region:'center',collapsible:false">
  	<iframe id="useriframe"  scrolling="auto" frameborder="0"  src="" style="width:100%;height:99%;"></iframe>';
 </div>
 </body>
</html>